package com.zookeeper.mine.study.service.impl;

import com.zookeeper.mine.study.dao.UserDao;
import com.zookeeper.mine.study.entity.User;
import com.zookeeper.mine.study.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public User findById(Long id) {
        return userDao.findById(id);
    }

    @Override
    public List<User> findAll() {
        return userDao.findAll();
    }

    @Override
    public Long insert(User user) {
        userDao.insert(user);
        return user.id;
    }
}
